define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'goods.bargain_controller/index',
        add_url: 'goods.bargain_controller/add',

        edit_url: 'goods.bargain_controller/edit',
        delete_url: 'goods.bargain_controller/delete',
        export_url: 'goods.bargain_controller/export',
        modify_url: 'goods.bargain_controller/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id1'},
                    {field: 'g_id', title: '砍价商品id'},
                    {field: 'title', title: '砍价活动名称'},
                    {field: 'info', title: '砍价活动简介'},
                    {field: 'bargain_stock', title: '砍价商品库存'},
                    {field: 'price', title: '商品价格'},
                    {field: 'bargain_price', title: '砍价目标金额'},
                    {field: 'bargain_max_price', title: '每次砍的最大金额'},
                    {field: 'bargain_min_price', title: '每次砍的最小金额'},
                    {field: 'bargain_num', title: '砍价总人数'},
                    {field: 'rule', title: '砍价规则'},
                    {field: 'status', title: '状态[0:关闭,1:开启]', templet: ea.table.switch},
                    {field: 'create_time', title: '创建时间'},
                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});